//
//  HomeMessageTableViewCell.m
//  GC_OC
//
//  Created by 曾 on 2022/1/16.
//

#import "HomeMessageTableViewCell.h"

@interface HomeMessageTableViewCell ()

@property (nonatomic, weak) UIImageView *iconView;
@property (nonatomic, weak) UILabel *titleLabel;
@property (nonatomic, weak) UILabel *contentLabel;

@end

@implementation HomeMessageTableViewCell

- (void)setupSubviews
{
    [super setupSubviews];
    
    UIImageView *iconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"meiti"]];
    [self.contentView addSubview:iconView];
    self.iconView = iconView;
    
    UILabel *titleLabel = [UILabel fk_labelWithFont:fk_adjustFont(17) textColor:fkColor333333];
    [self.contentView addSubview:titleLabel];
    self.titleLabel = titleLabel;
    
    UILabel *contentLabel = [UILabel fk_labelWithFont:fk_adjustFont(14) textColor:fkColor333333];
    [self.contentView addSubview:contentLabel];
    self.contentLabel = contentLabel;
    contentLabel.numberOfLines = 2;
    
    [iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.offset(fk_adjustW(15));
        make.left.offset(15);
        make.top.offset(12);
    }];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(iconView.mas_right).offset(6);
        make.right.offset(-15);
        make.centerY.equalTo(iconView);
    }];
    [contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(15);
        make.right.offset(-15);
        make.top.equalTo(iconView.mas_bottom).offset(6);
        make.bottom.offset(-12);
    }];
}

- (void)setData:(id)data
{
    [super setData:data];
    
    if ([data isKindOfClass:[NSDictionary class]]) {
        self.titleLabel.text = data[@"title"];
        self.contentLabel.text = data[@"content"];
    }
}

@end
